#ifndef GLOBAL_HPP
#define GLOBAL_HPP

class BaseData
{
public:
    BaseData()
    {}
    virtual ~BaseData()
    {}
};

class BasePrivate: public BaseData
{
public:
    BasePrivate()
    {}
    virtual ~BasePrivate()
    {}
};

template <typename T> static inline T *qGetPtrHelper(T *ptr) { return ptr; }
template <typename Wrapper> static inline typename Wrapper::pointer qGetPtrHelper(const Wrapper &p) { return p.get(); }

#define Q_DECLARE_PRIVATE(Class) \
inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(qGetPtrHelper(d_ptr)); } \
inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(qGetPtrHelper(d_ptr)); } \
friend class Class##Private;

#define Q_D(Class) Class##Private * const d = d_func()
#define Q_Q(Class) Class * const q = q_func()

#endif //GLOBAL_HPP
